package cn.tedu.boottext61.controller;

import cn.tedu.boottext61.mapper.UserMapper;
import cn.tedu.boottext61.vo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {
    //自动装配
    @Autowired(required = false)
    UserMapper mapper;

    @RequestMapping("/check")
    public int check(String username){
        User u = mapper.selectByUsername(username);
        return u == null?1:2;//1:数据库没有,可以注册   2:数据库拥有,不可以注册

    }
}
